<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt"  uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />

    <title><spring:message code="dingdanmingxi"></spring:message></title>
    <link href="${pageContext.request.contextPath }/phone/css/jiesuan.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath }/phone/css/font/iconfont.css" rel="stylesheet" type="text/css">

</head>
<body>
    <div>
       
        <!--头部--有分类-->
        <div class="cate_header">
            <div class="putong_top">
                <a href="javascript:history.go(-1);"></a>
                <div><spring:message code="dingdanmingxi"></spring:message></div>
            </div>
        </div>

        <div role="main" class="main" style="background:#F0F0F2;padding-bottom:0px;">
        <div class="nopay">
        <c:choose>
			<c:when test="${orders.oState==0}">
		     <spring:message code="daifukuan"></spring:message><br/>
			</c:when>
			<c:when test="${orders.oState==1}">
			 <spring:message code="yifukuan"></spring:message><br/>
			</c:when>
			<c:when test="${orders.oState==2}">
			 <spring:message code="yishouhuo"></spring:message><br/>
			</c:when>
		</c:choose> 
       </div>
            <h4><spring:message code="shouhuodizhi"></spring:message></h4>
            <div class="address2">
                <p>
                   ${orders.oName}  ${orders.oPhone}<br/>
                  ${orders.oAddress}${orders.oAddressInfo }
                </p>
            </div>
            <h4><spring:message code="fapiaoxinxi"></spring:message></h4>
            <div class="order_de">
            <c:if test="${orders.oInvoiceState==0}">
             <spring:message code="wu"></spring:message></c:if>
             <c:if test="${orders.oInvoiceState==1}">${orders.oPatternNo} </c:if>  
           </div>
            
            <h4><spring:message code="dingdanxinxi"></spring:message></h4>
            <div class="order_xx">
                <div class="order-title">
                   <spring:message code="dingdanbianhao"></spring:message>：${orders.oNo}
                    <i class="ri">
                    <c:choose>
					<c:when test="${orders.oState==0}">
				     <spring:message code="daifukuan"></spring:message><br/>
					</c:when>
					<c:when test="${orders.oState==1}">
					 <spring:message code="yifukuan"></spring:message><br/>
					</c:when>
					<c:when test="${orders.oState==2}">
					 <spring:message code="yishouhuo"></spring:message><br/>
					</c:when>
					</c:choose> 
                  </i>
                    
                </div>
                <c:forEach items="${orderslist}" var="item">
                <div class="order_con">
                
                <c:choose>
				<c:when test="${item.OL_TYPE!=3}">
                 <div class="order_img le" style="background-image:url(${imgpath }${item.OL_PATTERN_IMG});"></div>
                </c:when>
                <c:when test="${item.OL_TYPE==3}">
                 <div class="order_img le" style="background-image:url(${pageContext.request.contextPath }/upload/${item.MESSAGE3});"></div>
           	    </c:when>
               </c:choose>
                    <div class="order_content le">
                        <div>
                         <c:choose>
						<c:when test="${item.OL_TYPE==0}">
						<div class="name_title le">
							<span class="bian"><spring:message code="huaxing"></spring:message>：${item.OL_PATTERN_NO}</span><br>
							<span class="bian">${item.PP_NAME}</span>
						</div>
                           
                                  
						</c:when>
						<c:when test="${item.OL_TYPE==1}">
						<div class="name_title le">
							<span class="bian"><spring:message code="huaxing"></spring:message>：${item.OL_PATTERN_NO}</span>
						</div>
						</c:when>
						<c:when test="${item.OL_TYPE==2}">
						<div class="name_title le">
							<span class="bian"><spring:message code="huaxing"></spring:message>：${item.OL_PATTERN_NO}</span><br>
							<span class="bian"><spring:message code="mianliao"></spring:message>：${item.OL_FABRIC_NO}</span><br>
							<span class="bian">${item.PP_NAME}</span>
						</div>
						</c:when>
						<c:when test="${item.OL_TYPE==3}">
						
						<div class="name_title le">
							<span class="bian"><spring:message code="mianliao"></spring:message>：${item.OL_FABRIC_NO}</span>
						</div>
						</c:when>
						</c:choose> 
                           
                            <span class="ri w40" style="white-space: nowrap;text-overflow: ellipsis;display: block;overflow: hidden;text-align: right;">X${item.OL_FABRIC_SIZE}</span>
                            <div class="clr"></div>
                        </div>
                        <div class="jiage">￥<fmt:formatNumber pattern="0.00" value="${item.MESSAGE2 + 0.0001}"/><i class="ri">
                        <c:choose>
						<c:when test="${item.OL_TYPE==0}">
						<spring:message code="order.printing"></spring:message>
						
						</c:when>
						<c:when test="${item.OL_TYPE==1}">
						<spring:message code="order.buyout"></spring:message>
						</c:when>
						<c:when test="${item.OL_TYPE==2}">
						<spring:message code="order.finishedProduct"></spring:message>
						
						</c:when>
						<c:when test="${item.OL_TYPE==3}">
						<spring:message code="order.fabric"></spring:message>
						</c:when>
						</c:choose> 
                        
                        </i></div>
                    </div>
                    <div class="clr"></div>
                </div>
                </c:forEach>
                <div class="jine"><spring:message code="jinee"></spring:message>：￥${orders.oTotalPrice}</div>
            </div>
            <div class="order_de mar-t20 mar-b137"> <spring:message code="xiadanshijian"></spring:message>：<fmt:formatDate value="${orders.oCreatTime}" pattern="yyyy-MM-dd HH:mm:ss"/>  </div>
            
            <div class="jiesuan">
                <span><spring:message code="gongji"></spring:message>${fn:length(orderslist)}<spring:message code="jianshangpin"></spring:message> <spring:message code="jinee"></spring:message>：￥${orders.oTotalPrice}</span><br/>
                <a href="JavaScript:del(${orders.oId})" class="ri"><spring:message code="reciveAddress.delete"></spring:message></a>
                <c:if test="${orders.oState==0}">
                <a href="JavaScript:pay(${orders.oId})" class="ri"><spring:message code="qujiesuan"></spring:message></a>
                </c:if>
                <div class="clr"></div>
            </div>


        </div>

   </div>
    <form id="pay" target="_blank" action="${pageContext.request.contextPath}/web/orders/pay" method="post">
        <input type="hidden"  name="oId" id="oId">
        </form>
    <script src="${pageContext.request.contextPath }/phone/js/jquery-1.8.3.min.js"></script>
     <script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/layer/layer_mobile/layer.js"></script>
    <script src="${pageContext.request.contextPath }/phone/js/extra.js"></script>
<script type="text/javascript">

function del(id){
	 layer.open({
		    content: '<spring:message code="reciveAddress.confirmDeletion"></spring:message>'
		    ,btn: ['<spring:message code="reciveAddress.confirm"></spring:message>', '<spring:message code="reciveAddress.cancel"></spring:message>']
		    ,yes: function(index){
		    	$.ajax({
		   			 url:'${pageContext.request.contextPath }/web/orders/delorders',
		   			 async : false,
		   			 data: {oId:id},
		   			 type : "POST", 
		   			 success :function(result){
		   			 var status=result.msg.status;
		   			 var desc=result.msg.desc;
		   			 if(status == 0){
		   				layer.open({content: '<spring:message code="caozuochenggong"></spring:message>',skin: 'msg',time: 1});
			   	   		
		   				 location.href="${pageContext.request.contextPath }/api/orders/orderslist";
		   			 }else if(status == 2){//没登录
		   				layer.open({content: '<spring:message code="weidenglu"></spring:message>',skin: 'msg',time: 1});
			   	   		
		   			    }else if(status ==1){//失败
		   			    	layer.open({content: '<spring:message code="caozuoshibai"></spring:message>',skin: 'msg',time: 1});
		   		   	   		
		   			    }
		   			 }
		   			 });
		    	layer.close(index);
		    }
		  });
}

function pay(id){
	
	$.ajax({
			 url:'${pageContext.request.contextPath }/web/orders/chakandingdan',
			 async : false,
			 data: {"oId":id},
			 type : "GET", 
			 success :function(result){
			 if(result == "SUCCESS"){
				 $("#oId").val(id);
				$("#pay").submit();
			 }else{//失败
				 layer.open({content: '<spring:message code="huaxingyibeimaiduan"></spring:message>',skin: 'msg',time: 1});
		   	   		
			 }
			 }
			 });
	
	

	
}
</script>
</body>
</html>
